$ () ->
	$(".login_btn").click (e) ->
		_login()

	$(document).keypress (e) ->
		if event.keyCode is 13
			_login()

	_login = () ->
		param = 
			uname : $("#uname").val()
			password : $("#password").val()
		$.post "/api/admin/toLogin", param, (res) ->
			if res.status.errCode is 0
				window.location.href = '/admin/wechat-user/index'
			else
				alert res.status.message